package com.surprise.cweb.bo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import com.surprise.cweb.utils.ResponseUtils;
import com.surprise.webcommon.AppStatusCode;

/**
 * CommonRes.java
 * @author nick
 * @since 2015年7月19日
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class CommonRes {
	protected int status = 0;
	protected ErrorMsg msg;
	
	public static CommonRes SUCCESS = new CommonRes();
	public static CommonRes UNLOGIN = new CommonRes(
			AppStatusCode.SESSION_EXPIRED, new ErrorMsg()
			.setGlobal("用户未登录"));
	public static CommonRes UNAUTH = new CommonRes(AppStatusCode.USER_NOT_AUTH,
			new ErrorMsg().setGlobal("用户无权限对此数据进行操作"));
	
    public static CommonRes DATA_NOT_READY = ResponseUtils.errorMsg(AppStatusCode.DATA_NOT_READY, "数据不存在");
    public static CommonRes ODS_ERROR_MSG = ResponseUtils.errorMsg(AppStatusCode.APP_NOT_EXISTS, "短信发送失败");
	
	@Data
	@Accessors(chain = true)
	public static class ErrorMsg {
		private String global;
	}
}
